<!DOCTYPE html>
<html>

<head>
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
       <title></title>
       <link href="/styles/base.css" rel="stylesheet" type="text/css">
       <link href="/styles/addtravelnote.css" rel="stylesheet" type="text/css">
       <link href="/styles/wendadetail.css" rel="stylesheet" type="text/css">
       <link href="/js/ueditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
       <link href="/js/plugins/datepicker/datepicker.css" rel="stylesheet">
       <script type="text/javascript" src="/js/jquery/jquery.js"></script>
       <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.config.js"></script>
       <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.min.js"></script>
       <script type="text/javascript" src="/js/ueditor/lang/zh-cn/zh-cn.js"></script>
       <script src="/js/plugins/datepicker/datepicker.js"></script>
       <script src="/js/plugins/jquery-form/jquery.form.js"></script>

       <link href="/js/plugins/chosen/chosen.css" rel="stylesheet" type="text/css">
       <script type="text/javascript" src="/js/plugins/chosen/chosen.jquery.js"></script>
       <script type="text/javascript" src="/js/system/common.js"></script>
       <script type="text/javascript" src="/js/system/addAnswerComment.js"></script>
       <script>
           $(function () {content:
               $(".chose_pic").click(function () {
                   $("#coverBtn").click();
               })
               $("#coverBtn").change(function () {
                   if(this.value){
                       $("#coverForm").ajaxSubmit(function (data) {
                           $(".choseBtn").html(" + 重新选择");
                           $("#coverImage").attr("src", "/" +data);
                           $("#coverValue").val("/" + data);
                       })
                   }
               })

               /*//保存或发表
               $(".btn_submit, .btn_save").click(function () {
                   /!*var labels = [];
                   $('.pi-tagitem span').each(function (index, value) {
                       labels.push($(value).text());
                   })

                   $("#tagInput").val(labels.join(","))*!/
                   $("#state").val($(this).data("state"));
                   $("#editForm").ajaxSubmit(function (data) {
                       if(data.success){
                           window.location.href = "/travel/detail?id=" + data.data
                       }else{
                           popup("操作失败");
                       }
                   })
               })*/

               //目的地
               $("#region").chosen();


               //内容回显
               if('${tv!}'){
                   ue.setContent('${(tv.content)!}');
               }
           })

           $(function () {
               $("#commentBtn").click(function () {
                   var user = this.getAttribute("data-user");
                    console.log(user);
                    if(user == null || user == ""){
                        popup("请先登录在进行操作。一秒后跳转到登录页面");
                        setTimeout(function () {
                            window.location.href="http://localhost:8888/login.html";
                        },1000);
                    }else{
                       $("#editForm1").ajaxSubmit(function (data) {
                           $("#editor").html("");
                           $("#content2").append(data);
                       })
                    }
               })
           })

       </script>
</head>

<script>
   /* $(function () {
        //游记分页
        $(".com-opt").change(function () {
            $("#currentPage").val(1);
            $("#searchForm").submit();
        })
        $(".orderBy").click(function () {
            $(".orderBy").closest("div").removeClass("on");
            $(this).addClass("on");
            $("#currentPage").val(1);
            $("#orderType").val($(this).data("sort"))
            $("#searchForm").submit();
        })
    })
    $(function () {
        $(".btn-inputTravel").click(function () {
            var user = this.getAttribute("data-userInfo");
            console.log(user);
            if( user != null && user != ""){
                this.setAttribute("href","/travel/input")
            }else{
                alert("请您先登录后在执行此操作。");
            }
        })

        $(".btn-ding").click(function () {
            var travelId = this.getAttribute("data-id");
            var span = $(this).prev();
            $.get("/travel/travelThumbup",{travelId:travelId},function (data) {
                if(data.success){
                    $(span).html(data.data);
                    popup("顶成功啦啊啊啊");

                }else{
                    if(data.code == 102){
                        popup(data.msg);
                    }else{
                        popup("今天你已经顶过了");
                    }
                }
            })
        })
    })*/
    $(function () {
        $(".btn_hui").click(function () {
            //上一个评论用户的用户名
            var touser = $(this).data("touser");
            //上一个评论用户的mongoDB id
            var toid = $(this).data("toid");
           /* $("#ct").focus();
            $("#ct").attr("placeholder","回复：" + touser );*/

            $("#commentType").val(1);
            $("#refCommentId").val(toid);
        });
        $(".btn_fu").click(function () {

            //上一个评论用户的用户名
            var touser = $(this).data("touser");
            //上一个评论用户的mongoDB id
            var toid = $(this).data("toid");
        /*    $("#ct").focus();
            $("#ct").attr("placeholder","回复：" + touser );*/
            var content = $(this).prev();
            $("#commentType").val(1);
            $("#refCommentId").val(toid);
            $("#answerId").val(toid);
            $("#context").val($(content).val());
            console.log($("#context").val());
             $("#tianchong").ajaxSubmit(function (data) {
                 $(content).val("");
                 $(".comment-add").append(data);
                 window.location.reload();
             })
        });
    })

</script>

<body>
    <#assign currentNav="travel">
    <#include "../common/navbar.ftl">

    <!--文件上传-->
    <form action="/wenda/coverImageUpload" method="post" id="coverForm">
        <input type="file" name="pic" id="coverBtn" style="display: none;">
    </form>
    <div class="wrapper">
        <div class="crumb">
            <a href="/wenda/">旅游问答</a> &gt; <span>我要回答</span>
        </div>
        <div class="search-box">
            <div class="search-box">
                <div class="search-panel" data-cs-t="wenda">
                    <div class="clearfix _j_suggest_hd">
                        <div class="sp-input" style="margin-right: 10px;width: 500px;">
                            <input type="text" id="_j_wenda_seach_input" style="width: 90%;border: 0px;" value="" placeholder="提问前请先搜索，看看你的问题其他蜂蜂是否已经问过">
                        </div>
                        <input type="button" value="查询" id="btn_search" class="btn_webSearch" data-mddid="0" style="padding-right:50px; width: 50px;height: 45px; background: orange;border: 0px; border-radius: 10px;font-size: 20px;color: #fff">
                    </div>
                    <div class="bd _j_suggest_box hide">
                    </div>
                </div>
            </div>
        </div>
        <div class="q-detail" id="_js_askDetail">
            <!-- 问题详情 -->
            <div class="q-content">
                <div class="q-title">
                    <#--<a href="/wenda/area-10030.html" target="_blank" class="location"><i></i>三亚</a>-->
                    <h1>
                        提问的问题：
                        ${ans.title}
                    </h1>
                </div>
                <div class="q-desc" style="width: 65%"><img
                        class="_js_answerPic _j_show_original">${ans.content}<br></div>
                <div class="q-info1 clearfix">
                    <div class="q-tags fl">
                        <#list tags as t>
                            <a class="a-tag" href="/wenda/area-10030.html" target="_blank">${t.name}</a>
                        </#list>
                    </div>
                    <#if ans.isanonymity == 0>
                    <div class="pub-bar fr" style="width: 500px;">
                        <a href="/wenda/u/31184851/answer.html" class="photo" target="_blank"> <img src="${ans.author.headImgUrl}" width="16" height="16"></a>
                        <a class="name" href="/wenda/u/31184851/answer.html" target="_blank">${ans.author.nickname}</a>
                        <span class="time"><span>${(ans.createTime)?string("yyyy-MM-dd HH:mm")}</span></span>
                    </div>
                    <#else>
                        <div class="pub-bar fr" style="width: 500px;">
                            <a href="/wenda/u/31184851/answer.html" class="photo" target="_blank"> <img src="/images/default.jpg" width="16" height="16"></a>
                            <a class="name" href="/wenda/u/31184851/answer.html" target="_blank">匿名用户</a>
                            <span class="time"><span>${(ans.createTime)?string("yyyy-MM-dd HH:mm")}</span></span>
                        </div>
                    </#if>
                </div>
            </div>

            <div class="q-operate clearfix" style="width: 650px;">
            <#if userInfo ?? && ans.author.id == userInfo.id>

                <div class="fl">
                    <div class="qt-modify">
                        <a class="_j_modify _j_pop_hide" data-qid="18520444">补充问题</a>
                    </div>
                    <div class="qt-delete">
                        <a class="_j_delete">删除问题</a>
                    </div>
                </div>

            <#else>
                <div class="fl">
                    <div class="qt-modify">
                        <a class="_j_modify _j_pop_hide" data-qid="18520444">分享</a>
                    </div>
                    <div class="qt-delete">
                        <a class="_j_delete">邀请峰峰回答问题</a>
                    </div>
                </div>
            </#if>
                <div class="fr">
                    <span class="atten-num"><span>阅读数：</span>${ans.viewnum}</span>
                    <span class="atten-num"><span class="_j_same_num">${ans.thumbsupnum}</span>人关注</span>
                    <a role="button" href="#editForm1" style="background-color: orange;border-radius: 4px; width: 120px;font-size: 16px;color: #fff;" >回答</a>
                </div>
            </div>
            <!-- 修改问题内容 -->
            <div class="q-modify act-pop ap-modify _j_word hide _js_editorWrap _js_q_related_block" id="_js_answerText">
                <div class="q_title aa_operate tar-box _js_answerTitle clearfix">
                    <i class="_js_bold" title="加粗"></i>
                    <b></b>
                    <span class="insert_img" id="_j_pluplader_btn_container_1"><i class="ins-img aa_addpic" id="_js_upPicBar" title="插入图片" style="position: relative;"></i><div id="html5_1dg42oiiab221ovvt4m17i6f5l3_container" class="moxie-shim moxie-shim-html5" style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; overflow: hidden; z-index: -1;"><input id="html5_1dg42oiiab221ovvt4m17i6f5l3" type="file" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple="" accept="image/jpg,image/jpeg,image/png,image/gif,image/JPEG"></div></span>
                </div>
                <div class="wysiwyg-container"><textarea name="editor" class="_j_question_content" id="_js_editorText" style="display: none;">其味无穷二无群二群翁群无</textarea><div contenteditable="true" class="wysiwyg-editor">其味无穷二无群二群翁群无</div></div>
                <div class="ask_words clearfix" style="">
                    <span class="_j_word_num">12</span>/<span class="_j_max_num"></span> 字
                    <input class="btn-smodi _j_do_submit" type="button" value="确定修改">
                    <input class="btn-cmodi _j_do_cancel" type="button" value="放弃修改">
                </div>
            </div>
            <!-- 邀请回答 -->

          <#--  <div class="qa-bar-wrap _j_qaBar hide" style="display: none;">
                <div class="qa-bar-content">
                    <div class="q-operate">
                        <span class="atten-num">2浏览</span>
                        <span class="atten-num"><span class="_j_same_num">0</span>人关注</span>

                    </div>
                    <div class="q-title">
                        <a href="/wenda/area-10030.html" target="_blank" class="location"><i></i>三亚</a>
                        <h1>1232121312312312312</h1>
                    </div>
                </div>
            </div>-->
        </div>
        <div style="width: 65%" >
            <div id="content2">
            <#list comm as c>
            <li class="answer-item clearfix _j_answer_item _js_answer18519002 " data-aid="18519002">
                <div class="answer-content _js_answer_content">
                    <div class="answer-info clearfix">
                        <div class="user-bar fl">
                            <a class="_j_filter_click avatar" href="/wenda/u/86525799/answer.html" target="_blank"><img src="${c.headUrl}" width="48" height="48" class="photo"></a>
                            <a class="name" href="/wenda/u/86525799/answer.html" target="_blank">${c.username}</a>
                            <a class="level" href="/rank/lv.php?uid=86525799" target="_blank" rel="nofollow">${c.level}</a>
                        </div>
                    </div>

                    <div class="_j_long_answer_item">
                        <div class="_j_answer_html"><div class="area_tags _j_tip_mdd" data-mddid="14786">
                            ${c.content}
                            <br>====================================================================<br>
                            如果你觉得TA的回答不错，快来给TA点个赞吧！<br>
                            你的支持是对作者莫大的鼓励~</div>
                    </div>
                </div>
                <!-- 问答版权名片 -->
                <div class="a-operate _js_operate clearfix">
                    <div class="fl">
                        <!-- 问题分享 -->
                        <div class="q-share cate-share">
                            <a class="_js_showShare"><i class="q-share-icon"></i>分享</a>
                            <div class="share-pop _j_share_pop hide clearfix" data-title="和女朋友一起旅游，目的地选择哪儿" data-qid="18512843" data-aid="18519002">
                                <a title="分享到新浪微博" class="sina _j_do_share" data-site="wb" data-username="花开成海_Smile"></a>
                                <a title="分享到QQ空间" class="zone _j_do_share" data-site="qz" data-username="花开成海_Smile"></a>
                                <a title="分享到微信" class="weixin _j_do_share_wx" data-site="wx" data-username="花开成海_Smile"></a>
                            </div>
                        </div>
                        <div class="cmt-toggle">
                            <a class="_js_slideComment" data-cnum="0" data-default_words="添加评论"><i></i><span>添加评论</span></a>
                        </div>
                        <div class="collect">
                            <a class="_j_collect_answer"><i></i>收藏</a>
                        </div>
                        <div class="pub-time">
                            <i class="ico_phone"></i>  <span>${(c.createTime)?string("yyyy-MM-dd HH:mm")}</span>
                        </div>
                        <div class="tip-off">
                            <a data-japp="report" data-refer="http://www.mafengwo.cn/wenda/detail-18512843.html#answer18519002" data-refer-uid="86525799" data-app="qa.answer" data-busi-id="aid:18519002">举报</a>
                        </div>
                    </div>
                    <div class="fr">
                        <a class="btn-adopt _js_just_you">采纳为最佳答案</a>
                    </div>
                </div>

                <div class="comment-wrap _js_comments is_foldup_detail">
                  <#if c.state == 1>
                  <#list c.answerComments as f>
                    <div class="comment-add clearfix _j_word">
                        <div class="_js_comment_list">
                            <ul class="comment-list _j_comment_list_ul">
                                <li class="comment-item clearfix" data-cid="18247834" data-username="">
                                    <div class="comment-user">
                                        <a href="/u/46470179.html" target="_blank"><img src="${(f.headUrl)!}" class="photo"></a>
                                    </div>
                                    <dl>
                                        <dt>
                                            <a href="/u/46470179.html" target="_blank" class="c-name">${(f.username)!}</a>
                                            <a href="/rank/lv.php?uid=46470179" class="level" target="_blank">LV.${(f.level)!}</a><br>
                                            ${(f.content)!}
                                        </dt>
                                        <dd>
                                            <div class="c-info">
                                                <span class="c-time fl">${f.createTime?string("yyyy-MM-dd HH:mm")}</span>
                                                <span class="c-like _j_comment_like" data-cid="18247834" data-num="0">
                                                 <a class="btn-like " ></a>
                                                                        <font class="dianzan" data-t="1">赞</font>
                                    </span>
                                                <a role="button"  class="c-reply _j_publish_reply fr btn_hui"  data-touser="${c.username!}" data-toid="${c.id!}">回复</a>
                                                <a class="c-report fr" data-japp="report" data-refer="http://www.mafengwo.cn/wenda/detail-6892931-13651654.html" data-refer-uid="46470179" data-app="qa.answer.comment" data-busi-id="cid:18247834">举报</a>
                                            </div>
                                        </dd>
                                    </dl>
                                </li>
                            </ul>
                        </div>
                  </#list>
                  </#if>
                    <#--<#if c.refComment == null>-->
                    </div>
                       <div id="myform" class="comment-add clearfix _j_word">
                        <textarea id="ct" style="width: 100%" name="content1212" class="_j_content _j_word_check"></textarea>
                        <input class="btn-comment _j_publish_comment btn_fu" value="回复" type="button" data-touser="${(c.username)!}" data-toid="${(c.id)!}" >
                       </div>
                    <#--</#if>-->
                </div>
            </li>
            </#list>
                <script>
                    $(function () {
                        $(".dianzan").click(function () {
                            var a = $(this);
                            var flag = $(this).attr("data-t");
                            if(flag == 1){
                                $(a).attr("data-t","");
                                $(a).attr("data-t","0");
                                $(a).css("color","orange");
                            }else{
                                $(a).attr("data-t","");
                                $(a).attr("data-t","1");
                                $(a).css("color","#999");
                            }
                        })
                    })
                </script>
            <form class="forms" action="/wenda/commentAdd" method="post" id="tianchong">
                <input type="hidden" name="pid" id="answerId">
                <input type="hidden" name="travelTitle" value="${ans.title!}">
                <#--<input type="hidden" name="stateType" value="0" id="commentType">-->
                <input type="hidden" name="parentId" id="refCommentId">
                <input type="hidden" name="content" id="context">

            </div>
            </form>

        <div class="ap-wrap" >
                <form class="forms" action="/wenda/commentAdd" method="post" id="editForm1">
                    <input type="hidden" name="answerId" value="${(ans.id)!}">
                    <input type="hidden" name="answerTitle" value="${(ans.title)!}">
                    <div class="aa-hd">
                        <a class="aa-avatar" href="/wenda/u/31184851/answer.html"><img src="${(userInfo.headImgUrl)!'/images/default.jpg'}" class="photo" style="width: 30px;"></a>
                        <a class="aa-name">${(userInfo.nickname)!}</a>
                    </div>
                    <dl class="body cf">
                        <dd id="content_div">
                            <script id="editor" type="text/plain" style="width:100%;height:300px;"></script>
                        </dd>
                    </dl>
          </div>
                        <div class="aa-ft" style="margin-top: -20px;">
                                <button type="button" style="st;background: orange; color: #FFF;width: 114px;height: 30px;border: 0;float: right;border-radius: 5px;font-size: 16px;" class="_j_save_comment" id="commentBtn" data-user='${(userInfo)!}' >提交回答</button>
                                </div>
                                </form>
                                </div>
                                <div class="col-side" id="_js_right_side">

                        </div>

   <#include "../common/footer.ftl">
  </body>
                                </div>


</html>